/**
 * ZHU framework. Copyright 2012-, all rights reserved.
 *
 * $Id: LogoutController.java 43 2012-09-14 02:20:26Z zhuxiaopeng $
 * $Revision: 43 $
 * $Date: 2012-09-14 10:20:26 +0800 (五, 2012-09-14) $
 * $Author: zhuxiaopeng $
 */
package daily.web.login;

import javax.enterprise.context.*;
import javax.faces.context.*;
import javax.inject.*;
import javax.servlet.http.*;

import zhu.framework.web.jsf.*;

/**
 * <p>
 * </p>
 * 
 * @author $Author: zhuxiaopeng $
 * @version $Revision: 43 $ - $Date: 2012-09-14 10:20:26 +0800 (五, 2012-09-14) $
 */
@Named
@RequestScoped
public class LogoutController extends ConversationalController {

	public String logout() {
		endConversation();
		final HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
		final HttpSession session = request.getSession(false);
		session.invalidate();
		return "/login?faces-redirect=true";
	}
}
